home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / biz / demo / origins.lzh / ARexx / Ed_Gen.rexx < prev    next >
OS/2 REXX Batch file  |  1992-10-16  |  3KB  |  80 lines

  1. /********************************************/
  2. /* Edit a SOURCE or NOTE file from Origins */
  3. /********************************************/
  4.  
  5. /* NOTE:
  6.    This file is the same as EditGen.rexx, except it specifically calls Ed as
  7.    the editor of choice.
  8.  
  9.    To function correctly, this script must be renamed EditGen.rexx and copied
  10.    to the REXX: directory.
  11.  
  12.    This script will attempt to load the SOURCE or NOTE file requested by
  13.    Origins into Ed.  The function may be blocking or non-blocking by your
  14.    choice.  As written, the function is non-blocking.
  15.  
  16.    When Origins calls this script, it does so in a blocking manner; the
  17.    program won't continue until the script returns.  If you wish this
  18.    behaviour, make the script block until you are done with the file.
  19.    Otherwise, make the script return immediately.
  20.  
  21.    Since Ed doesn't do a ScreenToFront() when called, you'll have to
  22.    switch to the Workbench screen to see it.
  23.  
  24.    There appears to be a bug in Ed such that when you load an existing file,
  25.    and then load a new file, Ed returns error #3 (Insufficient memory).
  26.    This does not seem to cause any harm; the file is still created OK.  We
  27.    just thought you'd like to know this.
  28. */
  29.  
  30. /* Enable error handling routines */
  31. Signal On Error
  32. Signal On Syntax
  33. Signal On Halt
  34. Signal On IOErr
  35.  
  36. /* The name of Ed's ARexx port.  Always remember */
  37. /* that port names are case-sensitive.           */
  38. MyPort = 'Ed'
  39.  
  40. /* Get the name of the file to edit into this variable */
  41. parse arg Filename
  42.  
  43. /* If the editor isn't up, start it */
  44. If (~Show('P',MyPort)) then do
  45.     address command 'run Ed ' || Filename
  46.     Exit
  47. End
  48.  
  49. /* Else, set up the address... */
  50. address value MyPort
  51.  
  52. /* ...and tell the editor to load this file */
  53. 'OP /' || Filename || '/'
  54.  
  55. Exit
  56.  
  57. /**********************************************************************/
  58. /*                           Error Handling                           */
  59. /**********************************************************************/
  60.  
  61. Error:
  62.     Parse Source Type Num MacroName Script Prog Port
  63.     say 'ERROR: Macro "'MacroName'", Error: #'RC' ("'ErrorText(RC)'") on line 'SIGL' **'
  64.     exit
  65.  
  66. Syntax:
  67.     Parse Source Type Num MacroName Script Prog Port
  68.     say 'SYNTAX: Macro "'MacroName'", Error: #'RC' ("'ErrorText(RC)'") on line 'SIGL' **'
  69.     exit
  70.  
  71. Halt:
  72.     Parse Source Type Num MacroName Script Prog Port
  73.     say 'HALT: Macro "'MacroName'", Error: #'RC' on line 'SIGL' **'
  74.     exit
  75.  
  76. IOErr:
  77.     Parse Source Type Num MacroName Script Prog Port
  78.     say 'IOERR: Macro "'MacroName'", Error: #'RC' on line 'SIGL' **'
  79.     exit
  80.